import request from '@/utils/request'
export default {
  // 1 登录
  Adminlogin (courseInfo) {
    return request({
      url: '/user/login',
      method: 'post',
      data: courseInfo
    })
  },
  // 2 通过token获得信息
  getInfo (token) {
    return request({
      url: '/user/info',
      method: 'get',
      params: { token }
    })
  },
  // 3 更新用户
  updateInfo (admin) {
    return request({
      url: '/user/info',
      method: 'put',
      data: admin
    })
  },
  // 4 更新密码
  updatePassword (admin) {
    return request({
      url: '/user/password',
      method: 'put',
      data: admin
    })
  },
  // 5 创建用户
  createAdmin (admin) {
    return request({
      url: '/user/register',
      method: 'post',
      data: admin
    })
  },
  // 6 登出
  AdminLogout (courseInfo) {
    return request({
      url: '/adminservice/admin/logout',
      method: 'post',
      data: courseInfo
    })
  },
  // 7 普通用户登录
  createUser (courseInfo) {
    return request({
      url: '/user/signin',
      method: 'post',
      data: courseInfo
    })
  },
  // 8 获得角色列表
  getUserList (current, limit) {
    return request({
      url: `/user/list/${current}/${limit}`,
      method: 'get'
    })
  },
  // 10 封禁帐号
  disableUser (id) {
    return request({
      url: `/user/${id}/disable`,
      method: 'post'
    })
  },
  // 11 解封账号
  abledUser (id) {
    return request({
      url: `/user/${id}/enable`,
      method: 'post'
    })
  },
  // 12 用户申请重置密码
  applyUnsetPassword (form) {
    return request({
      url: `/apply/password/unset`,
      method: 'post',
      data: form
    })
  },
  // 13 重置密码登录
  unsetPasswordLogin (form) {
    return request({
      url: `/user/reset/login`,
      method: 'post',
      data: form
    })
  },
  resetPassword (password) {
    return request({
      url: `/user/reset/password`,
      method: 'post',
      data: {
        'password': password
      }
    })
  }
}
